/**
 * 更新用户信息
 */
 import { getUserInfo } from '../../../model/service/account/userInfo';
 import { updateUserPasswordService } from '../../../model/service/account/updateInfo';
 
 export default async function forgetPassword(ctx: Context, next: Next): Promise<void> {
   const { body } = ctx.request;
   // 判断是不是有用户的唯一id
   const { phoneNumber } = body;
   const result = await getUserInfo({ phoneNumber });
   if (result.length === 0) {
     ctx.api.fail(-1, '找不到该用户的信息，更新失败');
   } else {
     const result = await updateUserPasswordService(body);
     if (result.uid) {
        ctx.api.success({}, 'sucess')
     } else {
       ctx.api.fail(-1, '更改密码失败');
     }
     
   }
   return next();
 }